import request from '@/utils/request'

// 登录
export function login(data: { email: string; password: string; remember_me?: string }) {
  return request({
    url: '/login',
    method: 'post',
    data
  })
}

// 注销
export function logout(headers: any) {
  return request({
    url: '/logout',
    method: 'post',
    headers
  })
}

// 注册
export function register(data: {
  name: string
  email: string
  code: string
  password: string
  password_confirmation: string
}) {
  return request({
    url: '/register',
    method: 'post',
    data
  })
}

// 修改密码
export function resetPassword(
  data: {
    oldPassword: string
    password: string
    password_confirmation: string
  },
  headers: any
) {
  return request({
    url: '/resetPassword',
    method: 'post',
    data,
    headers
  })
}

// 找回密码
export function retrievePassword(data: {
  email: string
  password: string
  password_confirmation: string
  token: string
}) {
  return request({
    url: '/retrievePassword',
    method: 'post',
    data
  })
}
